package siar.web.realm;

import java.util.Enumeration;
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;

import com.sun.appserv.security.AppservRealm;
import com.sun.enterprise.security.auth.realm.BadRealmException;
import com.sun.enterprise.security.auth.realm.InvalidOperationException;
import com.sun.enterprise.security.auth.realm.NoSuchRealmException;
import com.sun.enterprise.security.auth.realm.NoSuchUserException;
import com.sun.enterprise.security.auth.realm.User;

public class SIARRealm extends AppservRealm {
	//private String jaasCtxName;
    //private String userCriteria;

    /*@Override
    protected void init(Properties props) throws BadRealmException, NoSuchRealmException { 
        jaasCtxName = props.getProperty("jaas-context", "MySuperRealm");
        userCriteria = props.getProperty("userCriteria", "j2ee");
    }*/


    /*
     * we have to implement something here even if we dont use it... 
     */
    public Enumeration getGroupNames(String string)  
            throws InvalidOperationException, NoSuchUserException {
        List groupNames = new LinkedList();
        return (Enumeration) groupNames;
    }


    /*@Override
    public String getJAASContext() {  return jaasCtxName;  }*/


    /*
     *  A string description of the authentication type being used.
     */
    public String getAuthType() {  
        return "siar";
    	//return "XXXX:  MySuperRealm";  
    }

    /*public String getUserCriteria() { 
        return userCriteria; 
    }


    public void logit(String str) {
        System.out.println(str);
    }*/


    /**
     * Returns the information recorded about a particular named user.
     *
     * @param name Name of the user whose information is desired.
     * @return The user object.
     * @exception NoSuchUserException if the user doesn't exist.
     * @exception BadRealmException if realm data structures are bad.
     */
    public User getUser(String name)
        throws NoSuchUserException
    {
        //logit("XXXX:  in MyRealm.getUser()");
        return null;
    }

	
	
	/*@Override
	public String getAuthType() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Enumeration getGroupNames(String arg0)
			throws InvalidOperationException, NoSuchUserException {
		// TODO Auto-generated method stub
		return null;
	}*/

}
